package main

import "fmt"

func Fibonacii(C, quit chan int) {
	x, y := 1, 1
	for {
		select {
		case C <- x:
			x = y
			y = x + y
		case <-quit:
			fmt.Println("quit")
			return
		}
	}
}

func main() {
	// select
	C := make(chan int)
	quit := make(chan int)
	go func() {
		for i := 0; i < 10; i++ {
			fmt.Println(<-C)
		}

		quit <- 0
	}()
	Fibonacii(C, quit)
}
